home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 14.2 KB | 437 lines | [TEXT/MPS ] |
- {
- File: Resources.p
-
- Contains: Resource Manager Interfaces.
-
- Version: Technology: System 7.5
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- }
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT Resources;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __RESOURCES__}
- {$SETC __RESOURCES__ := 1}
-
- {$I+}
- {$SETC ResourcesIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
-
- {$IFC UNDEFINED __TYPES__}
- {$I Types.p}
- {$ENDC}
- {$IFC UNDEFINED __MIXEDMODE__}
- {$I MixedMode.p}
- {$ENDC}
- {$IFC UNDEFINED __FILES__}
- {$I Files.p}
- {$ENDC}
- {$IFC FOR_SYSTEM8_COOPERATIVE }
- {$IFC UNDEFINED __FILEMANAGERTYPES__}
- {$I FileManagerTypes.p}
- {$ENDC}
- {$ENDC}
-
- {$PUSH}
- {$ALIGN MAC68K}
- {$LibExport+}
-
- {
- InitResources and RsrcZoneInit are no longer needed in Copland.
- * CFM provides the necessary run time initialization entry points.
- }
- {$IFC FOR_SYSTEM7_ONLY }
- FUNCTION InitResources: INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A995;
- {$ENDC}
- PROCEDURE RsrcZoneInit;
- {$IFC NOT GENERATINGCFM}
- INLINE $A996;
- {$ENDC}
- {$ENDC}
- {$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
-
- CONST
- resSysHeap = 64; { System or application heap? }
- resPurgeable = 32; { Purgeable resource? }
- resLocked = 16; { Load it in locked? }
- resProtected = 8; { Protected? }
- resPreload = 4; { Load in on OpenResFile? }
- resChanged = 2; { Resource changed? }
- mapReadOnly = 128; { Resource file read-only }
- mapCompact = 64; { Compact resource file }
- mapChanged = 32; { Write map out at update }
- resSysRefBit = 7; { reference to system/local reference }
- resSysHeapBit = 6; { In system/in application heap }
- resPurgeableBit = 5; { Purgeable/not purgeable }
- resLockedBit = 4; { Locked/not locked }
- resProtectedBit = 3; { Protected/not protected }
- resPreloadBit = 2; { Read in at OpenResource? }
- resChangedBit = 1; { Existing resource changed since last update }
- mapReadOnlyBit = 7; { is this file read-only? }
- mapCompactBit = 6; { Is a compact necessary? }
- mapChangedBit = 5; { Is it necessary to write map? }
- kResFileNotOpened = -1; { ref num return as error when opening a resource file }
- kSystemResFile = 0; { this is the default ref num to the system file }
-
-
- TYPE
- ResErrProcPtr = Register68kProcPtr; { PROCEDURE ResErr(thErr: OSErr); }
-
- ResErrUPP = UniversalProcPtr;
-
- CONST
- uppResErrProcInfo = $00001002;
-
- FUNCTION NewResErrProc(userRoutine: ResErrProcPtr): ResErrUPP;
- {$IFC NOT GENERATINGCFM }
- INLINE $2E9F;
- {$ENDC}
-
- PROCEDURE CallResErrProc(thErr: OSErr; userRoutine: ResErrUPP);
- {$IFC NOT GENERATINGCFM}
- {To be implemented: Glue to move parameters into registers.}
- {$ENDC}
- {$ENDC}
- {$IFC FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED }
- PROCEDURE CloseResFile(refNum: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A99A;
- {$ENDC}
- FUNCTION ResError: INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9AF;
- {$ENDC}
- FUNCTION CurResFile: INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A994;
- {$ENDC}
- FUNCTION HomeResFile(theResource: Handle): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A4;
- {$ENDC}
- PROCEDURE CreateResFile(fileName: Str255);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9B1;
- {$ENDC}
- FUNCTION OpenResFile(fileName: Str255): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A997;
- {$ENDC}
- PROCEDURE UseResFile(refNum: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A998;
- {$ENDC}
- FUNCTION CountTypes: INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A99E;
- {$ENDC}
- FUNCTION Count1Types: INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A81C;
- {$ENDC}
- PROCEDURE GetIndType(VAR theType: ResType; index: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A99F;
- {$ENDC}
- PROCEDURE Get1IndType(VAR theType: ResType; index: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A80F;
- {$ENDC}
- PROCEDURE SetResLoad(load: BOOLEAN);
- {$IFC NOT GENERATINGCFM}
- INLINE $A99B;
- {$ENDC}
- FUNCTION CountResources(theType: ResType): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A99C;
- {$ENDC}
- FUNCTION Count1Resources(theType: ResType): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A80D;
- {$ENDC}
- FUNCTION GetIndResource(theType: ResType; index: INTEGER): Handle;
- {$IFC NOT GENERATINGCFM}
- INLINE $A99D;
- {$ENDC}
- FUNCTION Get1IndResource(theType: ResType; index: INTEGER): Handle;
- {$IFC NOT GENERATINGCFM}
- INLINE $A80E;
- {$ENDC}
- FUNCTION GetResource(theType: ResType; theID: INTEGER): Handle;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A0;
- {$ENDC}
- FUNCTION Get1Resource(theType: ResType; theID: INTEGER): Handle;
- {$IFC NOT GENERATINGCFM}
- INLINE $A81F;
- {$ENDC}
- FUNCTION GetNamedResource(theType: ResType; name: Str255): Handle;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A1;
- {$ENDC}
- FUNCTION Get1NamedResource(theType: ResType; name: Str255): Handle;
- {$IFC NOT GENERATINGCFM}
- INLINE $A820;
- {$ENDC}
- PROCEDURE LoadResource(theResource: Handle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A2;
- {$ENDC}
- PROCEDURE ReleaseResource(theResource: Handle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A3;
- {$ENDC}
- PROCEDURE DetachResource(theResource: Handle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A992;
- {$ENDC}
- FUNCTION UniqueID(theType: ResType): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9C1;
- {$ENDC}
- FUNCTION Unique1ID(theType: ResType): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A810;
- {$ENDC}
- FUNCTION GetResAttrs(theResource: Handle): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A6;
- {$ENDC}
- PROCEDURE GetResInfo(theResource: Handle; VAR theID: INTEGER; VAR theType: ResType; VAR name: Str255);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A8;
- {$ENDC}
- PROCEDURE SetResInfo(theResource: Handle; theID: INTEGER; name: Str255);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A9;
- {$ENDC}
- PROCEDURE AddResource(theData: Handle; theType: ResType; theID: INTEGER; name: Str255);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9AB;
- {$ENDC}
- FUNCTION GetResourceSizeOnDisk(theResource: Handle): LONGINT;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A5;
- {$ENDC}
- FUNCTION GetMaxResourceSize(theResource: Handle): LONGINT;
- {$IFC NOT GENERATINGCFM}
- INLINE $A821;
- {$ENDC}
- FUNCTION RsrcMapEntry(theResource: Handle): LONGINT;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9C5;
- {$ENDC}
- PROCEDURE SetResAttrs(theResource: Handle; attrs: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A7;
- {$ENDC}
- PROCEDURE ChangedResource(theResource: Handle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9AA;
- {$ENDC}
- PROCEDURE RemoveResource(theResource: Handle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9AD;
- {$ENDC}
- PROCEDURE UpdateResFile(refNum: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A999;
- {$ENDC}
- PROCEDURE WriteResource(theResource: Handle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9B0;
- {$ENDC}
- PROCEDURE SetResPurge(install: BOOLEAN);
- {$IFC NOT GENERATINGCFM}
- INLINE $A993;
- {$ENDC}
- FUNCTION GetResFileAttrs(refNum: INTEGER): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9F6;
- {$ENDC}
- PROCEDURE SetResFileAttrs(refNum: INTEGER; attrs: INTEGER);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9F7;
- {$ENDC}
- FUNCTION OpenRFPerm(fileName: Str255; vRefNum: INTEGER; permission: SInt8): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9C4;
- {$ENDC}
- FUNCTION RGetResource(theType: ResType; theID: INTEGER): Handle;
- {$IFC NOT GENERATINGCFM}
- INLINE $A80C;
- {$ENDC}
- FUNCTION HOpenResFile(vRefNum: INTEGER; dirID: LONGINT; fileName: Str255; permission: SInt8): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A81A;
- {$ENDC}
- PROCEDURE HCreateResFile(vRefNum: INTEGER; dirID: LONGINT; fileName: Str255);
- {$IFC NOT GENERATINGCFM}
- INLINE $A81B;
- {$ENDC}
- FUNCTION FSpOpenResFile({CONST}VAR spec: FSSpec; permission: SignedByte): INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $700D, $AA52;
- {$ENDC}
- PROCEDURE FSpCreateResFile({CONST}VAR spec: FSSpec; creator: OSType; fileType: OSType; scriptTag: ScriptCode);
- {$IFC NOT GENERATINGCFM}
- INLINE $700E, $AA52;
- {$ENDC}
- PROCEDURE ReadPartialResource(theResource: Handle; offset: LONGINT; buffer: UNIV Ptr; count: LONGINT);
- {$IFC NOT GENERATINGCFM}
- INLINE $7001, $A822;
- {$ENDC}
- PROCEDURE WritePartialResource(theResource: Handle; offset: LONGINT; buffer: UNIV Ptr; count: LONGINT);
- {$IFC NOT GENERATINGCFM}
- INLINE $7002, $A822;
- {$ENDC}
- PROCEDURE SetResourceSize(theResource: Handle; newSize: LONGINT);
- {$IFC NOT GENERATINGCFM}
- INLINE $7003, $A822;
- {$ENDC}
- FUNCTION GetNextFOND(fondHandle: Handle): Handle;
- {$IFC NOT GENERATINGCFM}
- INLINE $700A, $A822;
- {$ENDC}
- {
- Use TempInsertROMMap to force the ROM resource map to be
- inserted into the chain in front of the system. Note that
- this call is only temporary - the modified resource chain
- is only used for the next call to the resource manager.
- See IM IV 19 for more information.
- }
- PROCEDURE TempInsertROMMap(tempResLoad: BOOLEAN);
- {$IFC OLDROUTINENAMES }
- FUNCTION SizeResource(theResource: Handle): LONGINT;
- {$IFC NOT GENERATINGCFM}
- INLINE $A9A5;
- {$ENDC}
- FUNCTION MaxSizeRsrc(theResource: Handle): LONGINT;
- {$IFC NOT GENERATINGCFM}
- INLINE $A821;
- {$ENDC}
- PROCEDURE RmveResource(theResource: Handle);
- {$IFC NOT GENERATINGCFM}
- INLINE $A9AD;
- {$ENDC}
- {$ENDC}
- {$ENDC}
-
- TYPE
- ResFileRefNum = INTEGER;
- ResID = INTEGER;
- ResAttributes = INTEGER;
- ResFileAttributes = INTEGER;
-
- CONST
- kResFileReadOnlyPermission = 100;
- kResFileReadWriteExclusivePermission = 101;
-
-
- TYPE
- ResFilePermissions = UInt32;
- {$IFC FOR_SYSTEM8_COOPERATIVE }
- FUNCTION RMRemoveResFileFromSearchPath(refNum: ResFileRefNum): OSStatus; C;
- FUNCTION RMAddResFileToSearchPath(refNum: ResFileRefNum): OSStatus; C;
- {
- * New API returning OSStatus, rolling in low mem, and fixing
- * some sins of the past.
- *
- }
- FUNCTION RMCreateResFile(fsFolderObjectRef: FSObjectRef; fsName: FSName; creator: OSType; theType: OSType): OSStatus; C;
- FUNCTION RMOpenResFile(specification: FSObjectRef; permissions: ResFilePermissions; resLoad: BOOLEAN; VAR refNum: ResFileRefNum): OSStatus; C;
- FUNCTION RMCloseResFile(refNum: ResFileRefNum): OSStatus; C;
- FUNCTION RMUpdateResFile(refNum: ResFileRefNum): OSStatus; C;
- FUNCTION RMUseResFile(refNum: ResFileRefNum): OSStatus; C;
- FUNCTION RMCurResFile(VAR refNum: ResFileRefNum): OSStatus; C;
- {
- * We don't want to support resource file attributes other then
- * the readOnly bit. Access to the readOnly bit is now gained
- * through the calls RMSetResFileReadOnlyState and RMGetResFileReadOnlyState.
- *
- * So, for now, we will not support RMGetResFileAttrs and RMSetResFileAttrs.
- *
- * OSStatus RMGetResFileAttrs(ResFileRefNum refNum, ResFileAttributes * attributes);
- * OSStatus RMSetResFileAttrs(ResFileRefNum refNum, ResFileAttributes attributes);
- }
- FUNCTION RMHomeResFile(theResource: Handle; VAR refNum: ResFileRefNum): OSStatus; C;
- FUNCTION RMAddResource(theData: Handle; theType: ResType; theID: ResID; name: Str255): OSStatus; C;
- FUNCTION RMRemoveResource(theResource: Handle): OSStatus; C;
- FUNCTION RMCountTypes(oneDeep: BOOLEAN; VAR count: UInt32): OSStatus; C;
- FUNCTION RMGetIndexedType(index: UInt32; oneDeep: BOOLEAN; VAR theType: ResType): OSStatus; C;
- FUNCTION RMCountResources(theType: ResType; oneDeep: BOOLEAN; VAR count: UInt32): OSStatus; C;
- FUNCTION RMGetIndexedResource(theType: ResType; index: UInt32; oneDeep: BOOLEAN; resLoad: BOOLEAN; VAR handle: Handle): OSStatus; C;
- FUNCTION RMGetResource(theType: ResType; theID: ResID; oneDeep: BOOLEAN; resLoad: BOOLEAN; VAR handle: Handle): OSStatus; C;
- FUNCTION RMGetNamedResource(theType: ResType; name: Str255; oneDeep: BOOLEAN; resLoad: BOOLEAN; VAR handle: Handle): OSStatus; C;
- FUNCTION RMLoadResource(theResource: Handle): OSStatus; C;
- FUNCTION RMReleaseResource(theResource: Handle): OSStatus; C;
- FUNCTION RMDetachResource(theResource: Handle): OSStatus; C;
- FUNCTION RMChangedResource(theResource: Handle): OSStatus; C;
- FUNCTION RMWriteResource(theResource: Handle): OSStatus; C;
- FUNCTION RMSetResourceSize(theResource: Handle; newSize: SInt32): OSStatus; C;
- FUNCTION RMUniqueID(theType: ResType; oneDeep: BOOLEAN; VAR idPtr: ResID): OSStatus; C;
- FUNCTION RMGetResAttributes(theResource: Handle; VAR attributes: ResAttributes): OSStatus; C;
- FUNCTION RMGetResInfo(theResource: Handle; VAR typePtr: ResType; VAR idPtr: ResID; VAR name: Str255): OSStatus; C;
- FUNCTION RMSetResInfo(theResource: Handle; theType: ResType; theID: ResID; name: Str255): OSStatus; C;
- FUNCTION RMSetResAttributes(theResource: Handle; attrs: ResAttributes): OSStatus; C;
- FUNCTION RMReadPartialResource(theResource: Handle; offset: UInt32; buffer: UNIV Ptr; count: UInt32): OSStatus; C;
- FUNCTION RMWritePartialResource(theResource: Handle; offset: UInt32; buffer: UNIV Ptr; count: UInt32): OSStatus; C;
- {
- * GetResourceSize returns either the size of the handle if the handle
- * is not empty or the size of the resource as stored on disk (i.e.
- * it has the exact semantics of GetResourceSizeOnDisk but does not
- * have the confusing name).
- }
- FUNCTION RMGetResourceSize(theResource: Handle; VAR size: SInt32): OSStatus; C;
- FUNCTION RMSetResErrProc(proc: ResErrUPP): OSStatus; C;
- {
- * For now, we don't know if we want to support the purge
- * proc in the future... it's an outstanding issue as stated in the
- * Design Document.
- *
- * OSStatus RMSetResPurge(Boolean install);
- }
- {
- * The following calls are used to get/set the read only state (i.e. the
- * mapReadOnly file attribute) of a resource file. When setting the state,
- * the state is set both in memory (i.e. taking affect immediately for all
- * other calls) and on disk (i.e. next time the file is opened, it will
- * be opened with the read only state set). The call RMSetResFileReadOnlyState
- * ignores the current state of the resource file. Setting the read only
- * state changes the current resource file attributes of the file both
- * in memory and on disk as appropriately (i.e. setting/clearing the read only state
- * will set/clear the mapReadOnly bit in memory and on disk).
- *
- * The read only state is checked when .... [this needs to be filled in -- it
- * will be exactly the same as when the mapReadOnly bit is checked].
- }
- FUNCTION RMSetResFileReadOnlyState(refNum: ResFileRefNum; isReadOnly: BOOLEAN): OSStatus; C;
- FUNCTION RMGetResFileReadOnlyState(refNum: ResFileRefNum; VAR isReadOnly: BOOLEAN): OSStatus; C;
- {$ENDC}
- {$ALIGN RESET}
- {$POP}
-
- {$SETC UsingIncludes := ResourcesIncludes}
-
- {$ENDC} {__RESOURCES__}
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-